package com.weaver.drools.business.execution.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.weaver.drools.business.execution.service.IEAqInquiryundertaker335Service;
import com.weaver.drools.common.dao.EAqInquiryundertaker335Dao;
import com.weaver.drools.common.entity.EAqInquiryundertaker335;
@Service
public class EAqInquiryundertaker335ServiceImpl implements IEAqInquiryundertaker335Service {

	@Autowired
	private EAqInquiryundertaker335Dao inquiryundertaker335Dao;
	@Override
	public EAqInquiryundertaker335 findById(Long inquiryundertakerid) {
		// TODO Auto-generated method stub
		return inquiryundertaker335Dao.findEAqInquiryundertaker335ByInquiryundertakerid(inquiryundertakerid);
	}

	@Override
	public void saveEAqInquiryundertaker335(EAqInquiryundertaker335 inquiryundertaker335) {
		inquiryundertaker335Dao.saveOrUpdate(inquiryundertaker335);
	}

	@Override
	public void updateEAqInquiryundertaker335(EAqInquiryundertaker335 inquiryundertaker335) {
		inquiryundertaker335Dao.saveOrUpdate(inquiryundertaker335);

	}

	@Override
	public void deleteById(Long inquiryundertakerid) {
		inquiryundertaker335Dao.deleteById(inquiryundertakerid);
	}

	@Override
	public List<EAqInquiryundertaker335> findList(String inquiryRecordId, String contactId) throws Exception {
		String hql="from EAqInquiryundertaker335 where isdeleted=0";
		if(inquiryRecordId!=null && !inquiryRecordId.equals("")){
			hql+=" and EAqInsInquiryrecord162.pnlinquiryrecordid="+inquiryRecordId;
		}
		if(contactId!=null && !contactId.equals("")){
			hql+=" and QSelfEnemploycontact72.contactid ="+contactId;
		}
		hql+=" order by inquiryundertakerid desc";
		
		return inquiryundertaker335Dao.findListByhql(hql);
	}

}
